<template>
  <div>
    <slot :x="x" :y="y"></slot>
  </div>
</template>

<script>
export default {
  data() {
    return {
      x: 0,
      y: 0
    }
  },
  mounted() {
    window.mousemoveHandle = e => {
      this.x = e.clientX
      this.y = e.clientY
    }
    window.addEventListener('mousemove', window.mousemoveHandle)
  },
  destroyed() {
    window.removeEventListener('mousemove', window.mousemoveHandle)
  }
}
</script>
